package cn.lili.modules.store.entity.vos;

import cn.lili.common.utils.BeanUtil;
import cn.lili.modules.store.entity.dos.Store;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import java.io.Serial;

/**
 * 店铺详细VO
 *
 * @author pikachu
 * @since 2020-03-09 21:53:20
 */
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class StoreVO extends Store {

    @Serial
    private static final long serialVersionUID = -7783778318124995269L;

    @NotBlank(message = "店铺经营类目不能为空")
    @ApiModelProperty(value = "店铺经营类目")
    private String[] businessCategorys;


    /**
     * 扩展如果需要返回店铺昵称非店铺名称则写入此字段
     */
    private String nickName;
    /**
     * 扩展是会员店铺在某些情况会返回这个字段
     */
    private String username;

    private String mobile;

    private String openId;
    private String account;
    private String fyName;

    private Integer auditFlag;

    private String urbanName;

    private String urbanUserId;

    public StoreVO(Store store) {
        BeanUtil.copyProperties(store, this);
        if (store.getBusinessCategory() != null) {
            this.businessCategorys = store.getBusinessCategory().split(",");
        }
    }

}
